﻿<!DOCTYPE HTML>
<html>
	<head>
		<title>山西警察学院网络安全保卫系在线考试系统在线考试</title>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/Print.js"></script>

		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/localstorage.min.js"></script>
		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/jquery.utils.min.js"></script>
		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/nicEdit.js"></script>
		
		<link rel="stylesheet" type="text/css" href="${request.contextPath}/statics/css/test/main.css">
		<link rel="stylesheet" type="text/css" href="${request.contextPath}/statics/css/test/iconfont.css">
		<link rel="stylesheet" type="text/css" href="${request.contextPath}/statics/css/test/exam.css">
		<style>
		/* nicEdit */
		.nicEdit-panel{
			display:none ;
		}
		</style>
		<script type="text/javascript">


		/*exam.js*************************************************************************************************************↓*/
		
		
		
			var studentID ;//当前登录人员id
			var ExamID ;//试卷id
			var xsId ;//中间表id，用以提交考试
			var remainTime ; //考试剩余时间（分钟）
			//$(function(){
			
				
				
				function singleClick(that){//单选题选项点击事件	
				//$(".single").click(function(){//单选题选项点击事件	
					console.log(that);
					console.log($(that).attr("optionid"));
					var QuestionID = $(that).attr("name");//singleAnswer1、singleAnswer2...
					var ExamAnswer = $(that).val();
					var OptionID = $(that).attr("optionid");
					windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer,OptionID);
					//答题结果存储↑
					//绘制答题卡↓
					var examId = $(that).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li>ID
					//console.log(examId);
					var cardLi = $('a[href=#' + examId + ']'); // 根据题目ID找到对应答题卡
					cardLi.addClass('hasBeenAnswer');
				//});				
				}
				
				function multipleClick(that){//多选题选项点击事件						
				//$(".multiple").click(function(){//多选题选项点击事件	
					console.log($(that).attr("optionid"));
					var examId = $(that).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li>ID
					//console.log(examId);
					var cardLi = $('a[href=#' + examId + ']'); // 根据题目ID找到对应答题卡
					
					var QuestionID = $(that).attr("name");//multipleAnswer1、multipleAnswer2...
					var ExamAnswer = getTheCheckBoxValue(QuestionID) ;
					var OptionID = getTheCheckBoxOptionId(QuestionID) ;
					if(ExamAnswer){//如果本多选题点击事件后有值
						windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer,OptionID);
						//答题结果存储↑
						//绘制答题卡↓
						cardLi.addClass('hasBeenAnswer');
					}else{//没有值的话，移除这个题的本地存储（相当于没有作答）
						var key = studentID+ExamID+QuestionID;
						window.localStorage.removeItem(key);
			            window.localStorage.removeItem(key + ".expires");
						//答题结果存储↑
						//绘制答题卡↓
						//把已答题标记也去掉
						cardLi.removeClass('hasBeenAnswer');
					}
				//});
				}
				
				function judgmentClick(that){//判断题选项点击事件	
					//$(".judgment").click(function(){//判断题选项点击事件，判断题和单选题逻辑完全一致
						console.log($(that).attr("optionid"));
						var QuestionID = $(that).attr("name");//judgmentAnswer1、judgmentAnswer2...
						var ExamAnswer = $(that).val();
						var OptionID = $(that).attr("optionid");
						windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer,OptionID);
						//答题结果存储↑
						//绘制答题卡↓
						var examId = $(that).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li>ID
						console.log(examId);
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');
					//});
				}
				
				//填空题答题事件↓
				function fillBlankTextareaFocus(that){//填空题聚焦事件	
				//$(".fillBlankTextarea").focus(function() {
					$(that).parent("label").addClass("activeFillBlank");
					$("label." + $(that).attr("id") + "").addClass("activeBlank");//class与被点击的textarea的id相同的label表现动画效果
					//$(".blank").addClass("activeBlank");
				//});
				}
				
				function fillBlankTextareaBlur(that){//填空题离焦事件
				//$(".fillBlankTextarea").blur(function() {   
					var QuestionID = $(that).attr("name");//singleAnswer1、singleAnswer2...
					//答题结果存储↓
					var thisFillBlankTestAllBlanks = $('textarea[name="' + QuestionID + '"]');					
					var ExamAnswer = "" ;//本填空题所有空的总答案，格式为----"锄禾日当午","汗滴禾下土","谁知盘中餐"
					var OptionId = ""; //本填空题所有空的总optionId如"aabbcc,ddeeff,gghhii"。
					thisFillBlankTestAllBlanks.each(function(){
						ExamAnswer += $(this).val().replace(/,/ig,'，')+",";//存储时将英文逗号转成中文逗号，防止与缓存中的存储方式冲突
						OptionId += $(this).attr('optionid')+",";
					});
					ExamAnswer = ExamAnswer.substring(0,ExamAnswer.length-1);
					ExamAnswer = escape(ExamAnswer);//存储编码的ExamAnswer
					OptionId = OptionId.substring(0,OptionId.length-1);
					windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer,OptionId);
					//答题结果存储↑
			
					//回填答题内容↓
					var thisExamAnswer = $(that).val();//本空的答案内容	
					var fillBlankTextareaValue = thisExamAnswer ? thisExamAnswer : "&nbsp;"//回填到下划线里的内容
					$("font." + $(that).attr("id") + "").html(fillBlankTextareaValue).attr("title",fillBlankTextareaValue);
					//回填答题内容↑
					//绘制答题卡↓
					if(thisExamAnswer){
						var examId = $(that).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li>ID
						//console.log(examId);
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');
					}
					//绘制答题卡↑
					$(that).parent("label").removeClass("activeFillBlank");
					$(".blank").removeClass("activeBlank");//清除所有的label表现动画效果
				//})
				}
				//填空题答题事件↑
				
				//论述题答题事件↓
				function discussionTextareaBlur(that){//改错题、论述题、综合应用题等大题离焦事件
				//$(".discussionTextarea").blur(function() {   
					var QuestionID = $(that).attr("name");//discussionAnswer1、discussionAnswer2...
					var ExamAnswer = $('textarea[name="' + QuestionID + '"]').val() ;
					var OptionId = $(that).attr("optionid");
					
					//答案结果存储和绘制答题卡↓
					var examId = $(that).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li>ID
					var cardLi = $('a[href=#' + examId + ']'); // 根据题目ID找到对应答题卡
					if(ExamAnswer){
						ExamAnswer = escape(ExamAnswer);//存储编码的ExamAnswer
						windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer,OptionId);
						cardLi.addClass('hasBeenAnswer');
					}else{//没有值的话，移除这个题的本地存储（相当于没有作答）
						var key = studentID+ExamID+QuestionID;
						window.localStorage.removeItem(key);
			            window.localStorage.removeItem(key + ".expires");
						//答题结果存储↑
						//绘制答题卡↓
						//把已答题标记也去掉
						cardLi.removeClass('hasBeenAnswer');
					}
					//答案结果存储和绘制答题卡↑
			
				//})
				}
				//论述题答题事件↑
				
				//重写标记事件↓	动态加载原因，原写法无法生效	
				function flagClick(that){
					if($(that).hasClass("flaged")){//已经标记的情况
						$(that).removeClass("flaged");
						//todo
						$(that).html("&#xe611;");
						$('a[href=#' + $(that).attr("id") + ']').parent().removeClass('hasBeenFlag');
						
						var QuestionID = "flags" ;
						var flagRst = getPerQuesInfo(QuestionID);
						var obj = eval("("+flagRst+")");  
						var examAnswerList = obj.ExamAnswer.split(",") ;
						examAnswerList.splice($.inArray($(that).attr("id"),examAnswerList),1);//删除examAnswer中被目前点击的flag
						//console.log(examAnswerList);
						windows.LocalStorage.save(studentID,ExamID,QuestionID,examAnswerList);//存储这个删除操作
					}else{//未标记的情况
						$(that).addClass("flaged");
						//todo
						$(that).html("&#xe612;");
						$('a[href=#' + $(that).attr("id") + ']').parent().addClass('hasBeenFlag');
						
						var QuestionID = "flags" ;
						var flagRst = getPerQuesInfo(QuestionID);
						var obj = eval("("+flagRst+")");  
						var examAnswer = obj.ExamAnswer;
						
						//这里examAnswer不需判断是否为空，为空依然符合逻辑
						var rst = $.inArray($(that).attr("id"),examAnswer.split(","));//判断examAnswer是否已包含了点击的flag，不包含返回-1.包含则返回所在序号
						//console.log(rst) ;
						
						if(rst == -1){//examAnswer不包含了点击的flag，也就是之前没有存过这个flag，才进行存储
							var newExamAnswer ;//修改的标记存储的值
							if(examAnswer){
								newExamAnswer = examAnswer + "," + $(that).attr("id") ;
							}else{
								newExamAnswer = $(that).attr("id") ;
							}
							windows.LocalStorage.save(studentID,ExamID,QuestionID,newExamAnswer);						
						}							
					}
					
				}
				//重写标记事件↑
			

				
			//});
			/**
			 * 读取本地存储答案并展示
			 */
			function showQuestion(){
				for(var i=0;i<single.quesNumber;i++){ //渲染单选题本地存储记录的答案
					var singleRst = getPerQuesInfo(single.questionIDs[i]);
					if(null!=singleRst){
						var obj = eval("("+singleRst+")");  
						var examAnswer = obj.ExamAnswer;
						$("input[name=" + single.questionIDs[i] + "]").each(function(){
							if($(this).val()==examAnswer){
								$(this).attr("checked",true);
			
								var examId = $(this).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li> ID
								var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
								cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
							}
						});
					}
				}
				
				for(var i=0;i<multiple.quesNumber;i++){ //渲染多选题本地存储记录的答案
					var multipleRst = getPerQuesInfo(multiple.questionIDs[i]);
					if(null!=multipleRst){
						var obj = eval("("+multipleRst+")");  
						var examAnswer = obj.ExamAnswer;
						
						var examId ;//存储已答题的<li> ID
						var checkBoxArray = examAnswer.split(",");
						for(var j=0;j<checkBoxArray.length;j++){
							$("input[name='" + multiple.questionIDs[i] + "']").each(function(){
								if($(this).val()==checkBoxArray[j]){
									$(this).attr("checked","checked");								
									examId = $(this).closest('.test_content_nr_main').closest('li').attr('id'); // 记录得到题目的<li> ID
								}
							});
							
							var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
							cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
						}
			
					}
				}
				
				for(var i=0;i<judgment.quesNumber;i++){ //渲染判断题本地存储记录的答案
					var judgmentRst = getPerQuesInfo(judgment.questionIDs[i]);
					if(null!=judgmentRst){
						var obj = eval("("+judgmentRst+")");  
						var examAnswer = obj.ExamAnswer;
						$("input[name=" + judgment.questionIDs[i] + "]").each(function(){
							if($(this).val()==examAnswer){
								$(this).attr("checked",true);
			
								var examId = $(this).closest('.test_content_nr_main').closest('li').attr('id'); // 得到题目的<li> ID
								//console.log(examId);
								var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
								cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
							}
						});
					}
				}
				
				for(var i=0;i<fill.quesNumber;i++){ //渲染填空题本地存储记录的答案
					var fillBlankRst = getPerQuesInfo(fill.questionIDs[i]);
					if(null!=fillBlankRst){
						var obj = eval("("+fillBlankRst+")");  
						var examAnswer = unescape(obj.ExamAnswer);
						
						var examId ;//存储已答题的<li> ID
						var fillBlankArray = examAnswer.split(",");
						for(var j=0;j<fillBlankArray.length;j++){
							if(fillBlankArray[j]){
								$($("textarea[name='" + fill.questionIDs[i] + "']")[j]).val(fillBlankArray[j]);	//渲染本填空的答案
								$("font." + $($("textarea[name='" + fill.questionIDs[i] + "']")[j]).attr("id") + "").html(fillBlankArray[j]).attr("title",fillBlankArray[j]);//并且回填到下划线里
								examId = $($("textarea[name='" + fill.questionIDs[i] + "']")[j]).closest('.test_content_nr_main').closest('li').attr('id'); // 记录得到题目的<li> ID
							}								
						}					
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
					}
				}
				
				for(var i=0;i<modify.quesNumber;i++){ //渲染改错题本地存储记录的答案
					var discussionRst = getPerQuesInfo(modify.questionIDs[i]);
					if(null!=discussionRst){
						var obj = eval("("+discussionRst+")");  
						var examAnswer = unescape(obj.ExamAnswer);
						
						$("textarea[name='" + modify.questionIDs[i] + "']").val(examAnswer);	//渲染改错题的答案
						var examId = $("textarea[name='" + modify.questionIDs[i] + "']").closest('.test_content_nr_main').closest('li').attr('id'); // 记录得到题目的<li> ID
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
					}
				}
				
				for(var i=0;i<discussion.quesNumber;i++){ //渲染论述题本地存储记录的答案
					var discussionRst = getPerQuesInfo(discussion.questionIDs[i]);
					if(null!=discussionRst){
						var obj = eval("("+discussionRst+")");  
						var examAnswer = unescape(obj.ExamAnswer);
						
						$("textarea[name='" + discussion.questionIDs[i] + "']").val(examAnswer);	//渲染论述题的答案
						var examId = $("textarea[name='" + discussion.questionIDs[i] + "']").closest('.test_content_nr_main').closest('li').attr('id'); // 记录得到题目的<li> ID
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
					}
				}
				
				for(var i=0;i<synthesis.quesNumber;i++){ //渲染综合应用题本地存储记录的答案
					var synthesisRst = getPerQuesInfo(synthesis.questionIDs[i]);
					if(null!=synthesisRst){
						var obj = eval("("+synthesisRst+")");  
						var examAnswer = unescape(obj.ExamAnswer);
						
						$("textarea[name='" + synthesis.questionIDs[i] + "']").val(examAnswer);	//渲染综合应用题的答案
						var examId = $("textarea[name='" + synthesis.questionIDs[i] + "']").closest('.test_content_nr_main').closest('li').attr('id'); // 记录得到题目的<li> ID
						var cardLi = $('a[href=#' + examId + ']'); // 根据题目的<li> ID找到对应答题卡
						cardLi.addClass('hasBeenAnswer');// 设置已答题的样式
					}
				}
				
				

				
			}
			/**
			 * 获取单个试题信息
			 */
			function getPerQuesInfo(QuestionID){
				var examKey = studentID+ExamID+QuestionID;
				var rst = windows.LocalStorage.get({
				   key : examKey
				});
				return rst;
			}		
			
			/**
			 * 打印
			 */
			function printClick(){
				$(".test_title").attr("style","display:none;");
				$("#test").attr("style","width:99.5%;");

				Print('#test');
				$(".test_title").attr("style","display:;");
				$("#test").attr("style","width:100%;");
			}
		/*exam.js*************************************************************************************************************↑*/
		
		
		
		//var examContent ;//试卷实体-整张试卷
		var single,multiple,judgment,fill,modify,discussion,synthesis ;//分别对应六大题型-单选题，多选题，判断题，填空题，改错题，论述题，综合应用题
		single = {
			quesNumber: 0,//单选题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//问题选项
			paper:"",//试卷dom
			answer:""//答题卡dom
		}		
		
		multiple = {
			quesNumber: 0,//多选题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//问题选项
			paper:"",//试卷dom
			answer:""//答题卡dom
		}
		
		judgment = {
			quesNumber: 0,//判断题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			questions: [],//问题题干
			titles:[],//问题主干
			options: [],//问题选项
			paper:"",//试卷dom
			answer:""//答题卡dom				
		}
		
		fill = {
			quesNumber: 0,//填空题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//存储输入的结果
			paper:"",//试卷dom
			answer:""//答题卡dom					
		}
		
		modify = {
			quesNumber: 0,//改错题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//存储输入的结果
			paper:"",//试卷dom
			answer:""//答题卡dom					
		}
		
		discussion = {
			quesNumber: 0,//解答题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//存储输入的结果
			paper:"",//试卷dom
			answer:""//答题卡dom					
		}
		
		synthesis = {
			quesNumber: 0,//综合应用题问题数量
			questionIDs: [],//题目id
			fs: [],//分数
			totalFs: 0,//题型总分
			titles:[],//问题主干
			questions: [],//问题题干
			options: [],//存储输入的结果
			paper:"",//试卷dom
			answer:""//答题卡dom					
		}
		
		
		$(function(){
			
 			$.ajax({
		        type: "POST",
		        url: "/sys/user/info",
		        dataType: "json",
		        success: function (result) {
		        	if(result.code == 0	){
		        		studentID = result.user.userId ;
		        	}else{
		        		alert("获取用户信息失败，请联系管理员");
		        	}
		        }
		    }); 
 			
			
			String.prototype.getParameter = function (key) {  
				var re = new RegExp(key + '=([^&]*)(?:&)?');  
				return this.match(re) && this.match(re)[1];  
			}; 
			var s = location.href;
			ExamID = s.getParameter("testId");
			xsId = s.getParameter("xsId");//中间表id，用以提交考试
			
  			remainTime = Math.ceil(s.getParameter("remainTime"));//考试剩余分钟(向上取整)
			console.log("remainTime");
			console.log(remainTime); 
			if(remainTime>0){
				if(remainTime>24*60){
	        		$(".test_time b").css({//因操作不当导致的考试跨天情况，取消跨天对样式造成的影响
	    			  	"font-size":"12px"
	    			});
				}
				var remainTimeHour = Math.floor( remainTime / 60 ) ;//剩余时间小时部分
				var remainTimeMinit = remainTime % 60 ;//剩余时间分钟部分
				$(".alt-1").html( remainTimeHour + ":" + remainTimeMinit ) ;				
			}else{
        		//$("input").attr("disabled",true);//如果要实现禁止答题需更改加载顺序
        		//$("textarea").attr("disabled",true);
        		$("input[name='test_jiaojuan']").val("考试已结束").attr("disabled",true).css({
    			  	"width":"120px"
    			}); 
			}

			var testName = decodeURI(s.getParameter("testName"));
			$("#testName").html(testName);
			//console.log(testName);
			console.log(ExamID) ;
			//ExamID = 'd595570c04424e01af8bc18e7c044969' ;//临时测试id,正式环境删除此行
			
			var data = {
				infoId:ExamID,
				deleteState:0
			};
			
 		    $.ajax({
		        type: "POST",
		        url: "/jysjtitle/queryByParam",
		        data: data,
		        dataType: "json",
		        success: function (result) { 
					console.log(result);
					if(result.code == 0){
						$(result.list).each(function(){
							console.log($(this));
							if($(this)[0].type=="1"){//单选题的类型为1
								single.type = 1;
								single.quesNumber++ ;
								single.questionIDs.push($(this)[0].id);
								single.fs.push($(this)[0].titleValue);
								single.totalFs += $(this)[0].titleValue ;
								single.titles.push( $(this)[0].title );
								try{
									single.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("single["+$(this)[0].id+"]的question解码异常");
									single.questions.push( $(this)[0].sjDescribe );
								}
								single.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="2"){//多选题的类型为2
								multiple.type = 2;
								multiple.quesNumber++ ;
								multiple.questionIDs.push($(this)[0].id);
								multiple.fs.push($(this)[0].titleValue);
								multiple.totalFs += $(this)[0].titleValue ;
								multiple.titles.push( $(this)[0].title );
								try{
									multiple.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("multiple["+$(this)[0].id+"]的question解码异常");
									multiple.questions.push( $(this)[0].sjDescribe );
								}
								multiple.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="4"){//判断题的类型为4
								judgment.type = 4;
								judgment.quesNumber++ ;
								judgment.questionIDs.push($(this)[0].id);
								judgment.fs.push($(this)[0].titleValue);
								judgment.totalFs += $(this)[0].titleValue ;
								judgment.titles.push( $(this)[0].title );
								try{
									judgment.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("judgment["+$(this)[0].id+"]的question解码异常");
									judgment.questions.push( $(this)[0].sjDescribe );
								}
								judgment.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="3"){//填空题的类型为3
								fill.type = 3;
								fill.quesNumber++ ;
								fill.questionIDs.push($(this)[0].id);
								fill.fs.push($(this)[0].titleValue);
								fill.totalFs += $(this)[0].titleValue ;
								fill.titles.push( $(this)[0].title );
								try{
									fill.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("fill["+$(this)[0].id+"]的question解码异常");
									fill.questions.push( $(this)[0].sjDescribe );
								}
								fill.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="6"){//改错题的类型为6
								modify.type = 6;
								modify.quesNumber++ ;
								modify.questionIDs.push($(this)[0].id);
								modify.fs.push($(this)[0].titleValue);
								modify.totalFs += $(this)[0].titleValue ;
								modify.titles.push( $(this)[0].title );
								try{
									modify.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("modify["+$(this)[0].id+"]的question解码异常");
									modify.questions.push( $(this)[0].sjDescribe );
								}
								modify.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="5"){//解答题的类型为5
								discussion.type = 5;
								discussion.quesNumber++ ;
								discussion.questionIDs.push($(this)[0].id);
								discussion.fs.push($(this)[0].titleValue);
								discussion.totalFs += $(this)[0].titleValue ;
								discussion.titles.push( $(this)[0].title );
								try{
									discussion.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("discussion["+$(this)[0].id+"]的question解码异常");
									discussion.questions.push( $(this)[0].sjDescribe );
								}
								discussion.options.push($(this)[0].optionList);
							}else if($(this)[0].type=="7"){//综合应用题的类型为7
								synthesis.type = 7;
								synthesis.quesNumber++ ;
								synthesis.questionIDs.push($(this)[0].id);
								synthesis.fs.push($(this)[0].titleValue);
								synthesis.totalFs += $(this)[0].titleValue ;
								synthesis.titles.push( $(this)[0].title );
								try{
									synthesis.questions.push( decodeURI($(this)[0].sjDescribe) );
								}catch(err){
									console.log("synthesis["+$(this)[0].id+"]的question解码异常");
									synthesis.questions.push( $(this)[0].sjDescribe );
								}
								synthesis.options.push($(this)[0].optionList);
							}
						});
						console.log(single);
						console.log(multiple);
						console.log(judgment);
						console.log(fill);
						console.log(modify);
						console.log(discussion);
						console.log(synthesis);
						
						if(single.quesNumber){//渲染单选题
							single.paper = single.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>单选题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+single.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+single.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							single.answer = single.answer
								+'<div class="rt_content open">'<!-- 初始化第一个rt_content为open，用于默认开始显示 -->
								+'	<div class="rt_content_tt link">'
								+'		<h2>单选题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+single.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:block;">'<!-- 初始化第一个submenu的样式block，用于默认开始显示 -->
							;	
							

							
							for( var i = 0 ; i < single.quesNumber ; ++i ){
								single.paper = single.paper 
									+'<li id="qu_'+single.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'	<i>'+(i+1)+'</i><span>('+single.fs[i]+'分)</span>'
									+'	<font>'+single.titles[i]+'</font>'
									+'<b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+single.type+'_'+i+'">&#xe611;</b><textarea id="nicEditorQuestion_'+single.type+'_'+i+'" style="width: 100%;" >'+single.questions[i]+'</textarea>'
									
									+'	</div>'								
																								
										+'	<div class="test_content_nr_main">'
									+'		<ul>'	
								;
								for( var j = 0 ; j < single.options[i].length ; ++j ){
									single.paper = single.paper 
										+'			<li class="option">'	
										+'				<input type="radio" class="radioOrCheck single" onclick="singleClick(this);" name="'+single.questionIDs[i]+'" '
										+'					id="'+single.type+'_answer_'+i+'_option_'+j+'" value="'+single.options[i][j].optionName+'" optionid="'+single.options[i][j].id+'" '
										+'				/>'		
										+'				<label for="'+single.type+'_answer_'+i+'_option_'+j+'">'
										+'					'+single.options[i][j].optionName+'.'
										+'					<p class="ue" style="display: inline;">'+single.options[i][j].optionKey+'</p>'
										+'				</label>'
										+'			</li>'	
									;
								}	
								single.paper = single.paper 	
									+'		</ul>'
									+'	</div>'	 	
									+'</li>'
								;	
									
								single.answer = single.answer	
									+'<li><a href="#qu_'+single.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							} 
							
							single.paper = single.paper 
								+'	</ul>'
								+'</div>'
							;
								
							single.answer = single.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(single.paper);
							
							$("#accordion").append(single.answer);
						}
						
						
						if(multiple.quesNumber){//渲染多选题
							multiple.paper = multiple.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>多选题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+multiple.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+multiple.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							multiple.answer = multiple.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>多选题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+multiple.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							

							
							for( var i = 0 ; i < multiple.quesNumber ; ++i ){
								multiple.paper = multiple.paper 
									+'<li id="qu_'+multiple.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'	<i>'+(i+1)+'</i><span>('+multiple.fs[i]+'分)'
									+'	<font>'+multiple.titles[i]+'</font>'
									+'</span><b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+multiple.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+multiple.type+'_'+i+'"  style="width: 100%;"  >'+multiple.questions[i]+'</textarea>'
									
									+'	</div>'								
																								
										+'	<div class="test_content_nr_main">'
									+'		<ul>'	
								;
								for( var j = 0 ; j < multiple.options[i].length ; ++j ){
									multiple.paper = multiple.paper 
										+'			<li class="option">'	
										+'				<input type="checkbox" class="radioOrCheck multiple" onclick="multipleClick(this);" name="'+multiple.questionIDs[i]+'" '
										+'					id="'+multiple.type+'_answer_'+i+'_option_'+j+'" value="'+multiple.options[i][j].optionName+'"  optionid="'+multiple.options[i][j].id+'"  '
										+'				/>'		
										+'				<label for="'+multiple.type+'_answer_'+i+'_option_'+j+'">'
										+'					'+multiple.options[i][j].optionName+'.'
										+'					<p class="ue" style="display: inline;">'+multiple.options[i][j].optionKey+'</p>'
										+'				</label>'
										+'			</li>'	
									;
								}	
								multiple.paper = multiple.paper 	
									+'		</ul>'
									+'	</div>'	 	
									+'</li>'
								;	
									
								multiple.answer = multiple.answer	
									+'<li><a href="#qu_'+multiple.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							} 
							
							multiple.paper = multiple.paper 
								+'	</ul>'
								+'</div>'
							;
								
							multiple.answer = multiple.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(multiple.paper);
							
							$("#accordion").append(multiple.answer);
						}
						
						if(judgment.quesNumber){//渲染判断题
							judgment.paper = judgment.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>判断题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+judgment.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+judgment.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							judgment.answer = judgment.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>判断题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+judgment.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							

							
							for( var i = 0 ; i < judgment.quesNumber ; ++i ){
								judgment.paper = judgment.paper 
									+'<li id="qu_'+judgment.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'	<i>'+(i+1)+'</i><span>('+judgment.fs[i]+'分)'
									+'	<font>'+judgment.titles[i]+'</font>'
									+'	</span><b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+judgment.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+judgment.type+'_'+i+'"  style="width: 100%;" >'+judgment.questions[i]+'</textarea>'
									
									+'	</div>'								
																								
										+'	<div class="test_content_nr_main">'
									+'		<ul>'	
								;
								for( var j = 0 ; j < judgment.options[i].length ; ++j ){
									judgment.paper = judgment.paper 
										+'			<li class="option">'	
										+'				<input type="radio" class="radioOrCheck judgment" onclick="judgmentClick(this);" name="'+judgment.questionIDs[i]+'" '
										+'					id="'+judgment.type+'_answer_'+i+'_option_'+j+'" value="'+judgment.options[i][j].optionName+'"  optionid="'+judgment.options[i][j].id+'"  '
										+'				/>'		
										+'				<label for="'+judgment.type+'_answer_'+i+'_option_'+j+'">'
										+'					'+judgment.options[i][j].optionName+'.'
										+'					<p class="ue" style="display: inline;">'+judgment.options[i][j].optionKey+'</p>'
										+'				</label>'
										+'			</li>'	
									;
								}	
								judgment.paper = judgment.paper 	
									+'		</ul>'
									+'	</div>'	 	
									+'</li>'
								;	
									
								judgment.answer = judgment.answer	
									+'<li><a href="#qu_'+judgment.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							} 
							
							judgment.paper = judgment.paper 
								+'	</ul>'
								+'</div>'
							;
								
							judgment.answer = judgment.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(judgment.paper);
							
							$("#accordion").append(judgment.answer);
						}						
						
						
						
						if(fill.quesNumber){//渲染填空题
							fill.paper = fill.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>填空题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+fill.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+fill.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							fill.answer = fill.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>填空题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+fill.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							
							
							for( var i = 0 ; i < fill.quesNumber ; ++i ){//这是新格式的敷衍做法，MLGB

								fill.paper = fill.paper 
									+'<li id="qu_'+fill.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'		<i>'+(i+1)+'</i><span>('+fill.fs[i]+'分)</span>'
									+'		<font>'+fill.titles[i]+'</font>'
									+'		<b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+fill.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+fill.type+'_'+i+'"  style="width: 100%;" >'+fill.questions[i]+'</textarea>'
									+'	</div>'
									+'	<div class="test_content_nr_main">'
								;
								
								for( var j = 0 ; j < fill.options[i].length  ; ++j ){
									fill.paper = fill.paper 	
										+'		<label class="fillBlank">'
										+'			<div style="float:left;width:5%;line-height: 50px;">'+fill.options[i][j].optionName+'</div>'
										+'			<div style="float:left;width:90%;"><textarea id="'+fill.type+'_answer_'+i+'_option_'+j+'" name="'+fill.questionIDs[i]+'" optionid="'+fill.options[i][j].id+'"  class="fillBlankTextarea" onfocus="fillBlankTextareaFocus(this);" onblur="fillBlankTextareaBlur(this);" type="text"  rows="6" maxlength="200"></textarea></div>'
										+'		</label>'
										+'		<br/>'
									;
								}
								
								fill.paper = fill.paper 	
									+'	</div>'
									+'</li>'	
								;
									
								fill.answer = fill.answer	
									+'<li><a href="#qu_'+fill.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							}
							
							
							/*
							for( var i = 0 ; i < fill.quesNumber ; ++i ){原格式被推翻
								
								//准备填空的题干↓
								questionsArray = fill.questions[i].split("（");//fill.questions[0] = "填空，请注意（A）这是一个（B）为什么（C）这个（D）"
								//console.log(questionsArray);// ["填空，请注意", "A）这是一个", "B）为什么", "C）这个", "D）"]
								for(var n = 1 ; n < questionsArray.length ; ++n){
									questionsArray[n] = questionsArray[n].substring(2,questionsArray[n].length);
								}
								//console.log(questionsArray);//["填空，请注意", "这是一个", "为什么", "这个", ""]								
								//准备填空的题干↑
								
								fill.paper = fill.paper 
									+'<li id="qu_'+fill.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'		<i>1</i><span>(10分)</span>'
								;			
									
									
								for( var j = 0 ; j < questionsArray.length -1 ; ++j ){	
									fill.paper = fill.paper 
										+'		<font>'+questionsArray[j]+'</font>'
										+'		<label class="blank '+fill.type+'_answer_'+i+'_option_'+j+'" >'
										+'			<font class="blankFont '+fill.type+'_answer_'+i+'_option_'+j+'">&nbsp;</font>'
										+'		</label>'
									;			
								}
								
								if(questionsArray.length > 1){
									fill.paper = fill.paper 
										+'		<font>'+questionsArray[questionsArray.length-1]+'</font>'
									;	
								}
	
								fill.paper = fill.paper 		
									+'		<b class="icon iconfont flag" onclick="flagClick(this);" id="qu_'+fill.type+'_'+i+'">&#xe611;</b>'
									+'	</div>'
									+'	<div class="test_content_nr_main">'
								;
										
								for( var j = 0 ; j < questionsArray.length -1 ; ++j ){
									fill.paper = fill.paper 	
										+'		<label class="fillBlank">'
										+'			<textarea id="'+fill.type+'_answer_'+i+'_option_'+j+'" name="'+fill.questionIDs[i]+'" optionid="'+fill.options[i][j].id+'"  class="fillBlankTextarea" onfocus="fillBlankTextareaFocus(this);" onblur="fillBlankTextareaBlur(this);" type="text"  rows="6" maxlength="200"></textarea>'
										+'		</label>'
										+'		<br/>'
									;
								}
								
								fill.paper = fill.paper 
									+'	</div>'
									+'</li>'	
								;
									
									
								fill.answer = fill.answer	
									+'<li><a href="#qu_'+fill.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							}*/							
							
							fill.paper = fill.paper 
								+'	</ul>'
								+'</div>'
							;
								
							fill.answer = fill.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(fill.paper);
							
							$("#accordion").append(fill.answer);
							
							
						}
						
						
						if(modify.quesNumber){//渲染改错题
							modify.paper = modify.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>改错题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+modify.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+modify.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							modify.answer = modify.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>改错题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+modify.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							
							

							
							for( var i = 0 ; i < modify.quesNumber ; ++i ){
								
								modify.paper = modify.paper 
									+'<li id="qu_'+modify.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'		<i>'+(i+1)+'</i><span>('+modify.fs[i]+'分)</span>'
									+'		<font>'+modify.titles[i]+'</font>'
									+'		<b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+modify.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+modify.type+'_'+i+'"  style="width: 100%;" >'+modify.questions[i]+'</textarea>'
									+'	</div>'
									+'	<div class="test_content_nr_main">'
									+'		<textarea id="'+modify.type+'_answer_'+i+'" name="'+modify.questionIDs[i]+'" class="discussionTextarea"  optionid="'+modify.options[i][0].id+'"  onblur="discussionTextareaBlur(this);" type="text"  rows="12" maxlength="2000"></textarea>'
									+'	</div>'
									+'</li>'	
								;
									
								modify.answer = modify.answer	
									+'<li><a href="#qu_'+modify.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							}
							
							modify.paper = modify.paper 
								+'	</ul>'
								+'</div>'
							;
								
							modify.answer = modify.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(modify.paper);
							
							$("#accordion").append(modify.answer);
							
							
						}
						
						

						if(discussion.quesNumber){//渲染解答题
							discussion.paper = discussion.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>解答题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+discussion.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+discussion.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							discussion.answer = discussion.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>解答题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+discussion.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							
							

							
							for( var i = 0 ; i < discussion.quesNumber ; ++i ){
								
								discussion.paper = discussion.paper 
									+'<li id="qu_'+discussion.type+'_'+i+'">'
									+'	<div class="test_content_nr_tt">'
									+'		<i>'+(i+1)+'</i><span>('+discussion.fs[i]+'分)</span>'
									+'		<font>'+discussion.titles[i]+'</font>'
									+'		<b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+discussion.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+discussion.type+'_'+i+'"  style="width: 100%;" >'+discussion.questions[i]+'</textarea>'
									+'	</div>'
									+'	<div class="test_content_nr_main">'
									+'		<textarea id="'+discussion.type+'_answer_'+i+'" name="'+discussion.questionIDs[i]+'" class="discussionTextarea"  optionid="'+discussion.options[i][0].id+'"  onblur="discussionTextareaBlur(this);" type="text"  rows="12" maxlength="2000"></textarea>'
									+'	</div>'
									+'</li>'	
								;
									
								discussion.answer = discussion.answer	
									+'<li><a href="#qu_'+discussion.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							}
							
							discussion.paper = discussion.paper 
								+'	</ul>'
								+'</div>'
							;
								
							discussion.answer = discussion.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(discussion.paper);
							
							$("#accordion").append(discussion.answer);
							
							
						}
						
						
						if(synthesis.quesNumber){//渲染综合应用题(综合应用题和解答题使用同一套策略)
							synthesis.paper = synthesis.paper
								+'<div class="test_content">'
								+'	<div class="test_content_title">'
								+'		<h2>综合应用题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+synthesis.quesNumber+'</i><span>题，</span><span>合计</span><i class="content_fs">'+synthesis.totalFs+'</i><span>分</span>'
								+'		</p>'
								+'	</div>'
								+'</div>'
								+'<div class="test_content_nr">'
								+'	<ul>'								
							;	
							
							synthesis.answer = synthesis.answer
								+'<div class="rt_content">'
								+'	<div class="rt_content_tt link">'
								+'		<h2>综合应用题</h2>'
								+'		<p>'
								+'			<span>共</span><i class="content_lit">'+synthesis.quesNumber+'</i><span>题</span>'
								+'		</p>'
								+'	</div>'
								+'	<ul class="submenu answerSheet" style="display:;">'
							;	
							
							

							
							for( var i = 0 ; i < synthesis.quesNumber ; ++i ){
								if(synthesis.options[i][0]){
									synthesis.paper = synthesis.paper 
										+'<li id="qu_'+synthesis.type+'_'+i+'">'
										+'	<div class="test_content_nr_tt">'
										+'		<i>'+(i+1)+'</i><span>('+synthesis.fs[i]+'分)</span>'
										+'		<font>'+synthesis.titles[i]+'</font>'
										+'		<b class="icon iconfont flag" onclick="flagClick(this);"  id="qu_'+synthesis.type+'_'+i+'">&#xe611;</b><textarea  id="nicEditorQuestion_'+synthesis.type+'_'+i+'"  style="width: 100%;" >'+synthesis.questions[i]+'</textarea>'
										+'	</div>'
										+'	<div class="test_content_nr_main">'
										+'		<textarea id="'+synthesis.type+'_answer_'+i+'" name="'+synthesis.questionIDs[i]+'" class="discussionTextarea"  optionid="'+synthesis.options[i][0].id+'"  onblur="discussionTextareaBlur(this);" type="text"  rows="12" maxlength="2000"></textarea>'
										+'	</div>'
										+'</li>'	
									;									
								}else{
									console.log("WARNING:synthesis.options["+i+"][0]缺失，无法绘制试题");
								}

									
								synthesis.answer = synthesis.answer	
									+'<li><a href="#qu_'+synthesis.type+'_'+i+'">'+(i+1)+'</a></li>'
								;
							}
							
							synthesis.paper = synthesis.paper 
								+'	</ul>'
								+'</div>'
							;
								
							synthesis.answer = synthesis.answer		
								+'	</ul>'
								+'</div>'	
							;
							
							$("#paper").append(synthesis.paper);
							
							$("#accordion").append(synthesis.answer);
							
							
						}
						
						
					}else{
						alert("试卷信息异常，请联系管理员");
					}
					
		        }
		    });
			
		    
		    //最后一步渲染试卷答案
			setTimeout(function(){
				
				showQuestion();
				
				var examPropertyRst = getPerQuesInfo("examProperty");//规定本地存储的QuestionID存储"examProperty"，专门存储考试的属性信息，考试剩余时间存在OptionID中；是否已交卷，存在ExamAnswer字段，0表示未交卷，1表示已交卷"
				if(null!=examPropertyRst){
					var obj = eval("("+examPropertyRst+")"); 
					if(obj.ExamAnswer == 1){//已经交卷的情况
		        		$("input").attr("disabled",true);
		        		$("textarea").attr("disabled",true);
		        		$("input[name='test_jiaojuan']").val("试卷已提交");
			        	$("input[name='test_jiaojuan']").css({
	        			  	"width":"120px"
	        			}); 						
					}
				}else{//初始化标记,存储0未交卷
					var QuestionID = "examProperty" ;
					var ExamAnswer = "0" ;
					windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer);
				}
				
				var flagRst = getPerQuesInfo("flags");//规定本地存储的QuestionID存储"flags"，专门存储已标记的题目的ids，存在ExamAnswer，如"qu_0_0,qu_1_3"
				if(null!=flagRst){
					var obj = eval("("+flagRst+")");  
					var examAnswer = obj.ExamAnswer;
					var flagArrList = examAnswer.split(",");
					//console.log(flagArrList);				
					$.each(flagArrList,function(item){//为已标记的题目的旗子执行点击事件
						$(".flag[id='" + flagArrList[item] + "']").click();				
					});
				}else{//初始化标记,存储空串表示目前还没有标记
					var QuestionID = "flags" ;
					var ExamAnswer = "" ;
					windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer);
				}
				
				// 答题卡展开样式↓ 
				var Accordion = function(el, multiple) {
					this.el = el || {};
					this.multiple = multiple || false;
			
					// Variables privadas
					var links = this.el.find('.link');
					// Evento
					links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown);
				}
			
				Accordion.prototype.dropdown = function(e) {
					var $el = e.data.el;
						$this = $(this),
						$next = $this.next();
			
					$next.slideToggle();
					$this.parent().toggleClass('open');
			
					if (!e.data.multiple) {
						$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
					};
				}	
			
				var accordion = new Accordion($('#accordion'), false);		
				
				//答题卡展开样式↑ 
				
			},500);
		    
		    


		});
		
		bkLib.onDomLoaded(function() {
			
			setTimeout(function(){
				
				if(single.quesNumber){
					for( var i = 0 ; i < single.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+single.type+"_"+i  ,{hasPanel : false} );
					}
				}
				
 				if(multiple.quesNumber){
					for( var i = 0 ; i < multiple.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+multiple.type+"_"+i ,{hasPanel : false});
					}
				} 
 				
 				if(judgment.quesNumber){
					for( var i = 0 ; i < judgment.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+judgment.type+"_"+i ,{hasPanel : false});
					}
				}
				
				if(fill.quesNumber){
					for( var i = 0 ; i < fill.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+fill.type+"_"+i ,{hasPanel : false});
					}
				}
				
				if(modify.quesNumber){
					for( var i = 0 ; i < modify.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+modify.type+"_"+i ,{hasPanel : false});
					}
				}
 				
 				if(discussion.quesNumber){
					for( var i = 0 ; i < discussion.quesNumber ; ++i ){
						new nicEditor().panelInstance("nicEditorQuestion_"+discussion.type+"_"+i ,{hasPanel : false});
					}
				}
 				
 				if(synthesis.quesNumber){
					for( var i = 0 ; i < synthesis.quesNumber ; ++i ){
						if(synthesis.options[i][0]){
							new nicEditor().panelInstance("nicEditorQuestion_"+synthesis.type+"_"+i ,{hasPanel : false});
						}else{
							console.log("WARNING:synthesis.options["+i+"][0]缺失,无法转码试题");
						}
					}
				}
 				
			},1500);
		});
		
		function submitPaper(that){//交卷事件
	    	if(confirm("是否确认交卷？该操作无法撤回")){
	    		
	    		//把数组转成JSON对象
	    		 
	    		var arr=new Array();
	    		var jsonSubmit ;//转成json格式作为最终提交的结果


 				for(var i=0;i<single.quesNumber;i++){
					var singleRst = getPerQuesInfo(single.questionIDs[i]);
					if(null!=singleRst){
						var singleObj = eval("("+singleRst+")");  
						singleObj.sjXsId = xsId	;					//试卷id
						singleObj.sjTitleId = singleObj.QuestionID ;			//试题id
						singleObj.stOptionId = singleObj.OptionID ;				//选项id
						singleObj.stText = singleObj.ExamAnswer	;				//试题答案
						singleObj.score = 10;									//分数
						singleObj.deleteState = 0 ;								//删除状态						
						arr.push(singleObj);
					}
				} 
	    		
 				for(var i=0;i<multiple.quesNumber;i++){
					var multipleRst = getPerQuesInfo(multiple.questionIDs[i]);
					if(null!=multipleRst){
						var multipleObj = eval("("+multipleRst+")");  
						multipleObj.sjXsId = xsId	;					//试卷id
						multipleObj.sjTitleId = multipleObj.QuestionID ;			//试题id
						multipleObj.stOptionId = multipleObj.OptionID ;				//选项id
						multipleObj.stText = multipleObj.ExamAnswer	;				//试题答案
						multipleObj.score = 10;										//分数
						multipleObj.deleteState = 0 ;								//删除状态						
						arr.push(multipleObj);
					}
				} 
 				
 				for(var i=0;i<judgment.quesNumber;i++){
					var judgmentRst = getPerQuesInfo(judgment.questionIDs[i]);
					if(null!=judgmentRst){
						var judgmentObj = eval("("+judgmentRst+")");  
						judgmentObj.sjXsId = xsId	;					//试卷id
						judgmentObj.sjTitleId = judgmentObj.QuestionID ;			//试题id
						judgmentObj.stOptionId = judgmentObj.OptionID ;				//选项id
						judgmentObj.stText = judgmentObj.ExamAnswer	;				//试题答案
						judgmentObj.score = 10;										//分数
						judgmentObj.deleteState = 0 ;								//删除状态						
						arr.push(judgmentObj);
					}
				} 
 				
 				for(var i=0;i<fill.quesNumber;i++){
					var fillRst = getPerQuesInfo(fill.questionIDs[i]);
					if(null!=fillRst){
						var fillObj = eval("("+fillRst+")");  
						fillObj.sjXsId = xsId	;					//试卷id
						fillObj.sjTitleId = fillObj.QuestionID ;			//试题id
						fillObj.stOptionId = fillObj.OptionID ;				//选项id
						fillObj.stText = unescape(fillObj.ExamAnswer)	;				//试题答案
						fillObj.score = 10;									//分数
						fillObj.deleteState = 0 ;							//删除状态						
						arr.push(fillObj);
					}
				} 
 				
				for(var i=0;i<modify.quesNumber;i++){
					var modifyRst = getPerQuesInfo(modify.questionIDs[i]);
					if(null!=modifyRst){
						var modifyObj = eval("("+modifyRst+")");  
						modifyObj.sjXsId = xsId	;					//试卷id
						modifyObj.sjTitleId = modifyObj.QuestionID ;			//试题id
						modifyObj.stOptionId = modifyObj.OptionID ;				//选项id
						modifyObj.stText = unescape(modifyObj.ExamAnswer);		//试题答案
						modifyObj.score = 10;									//分数
						modifyObj.deleteState = 0 ;								//删除状态						
						arr.push(modifyObj);
					}
				} 
				
 				for(var i=0;i<discussion.quesNumber;i++){
					var discussionRst = getPerQuesInfo(discussion.questionIDs[i]);
					if(null!=discussionRst){
						var discussionObj = eval("("+discussionRst+")");  
						discussionObj.sjXsId = xsId	;					//试卷id
						discussionObj.sjTitleId = discussionObj.QuestionID ;			//试题id
						discussionObj.stOptionId = discussionObj.OptionID ;				//选项id
						discussionObj.stText = unescape(discussionObj.ExamAnswer)	;				//试题答案
						discussionObj.score = 10;										//分数
						discussionObj.deleteState = 0 ;									//删除状态						
						arr.push(discussionObj);
					}
				} 
 				
 				for(var i=0;i<synthesis.quesNumber;i++){
					var synthesisRst = getPerQuesInfo(synthesis.questionIDs[i]);
					if(null!=synthesisRst){
						var synthesisObj = eval("("+synthesisRst+")");  
						synthesisObj.sjXsId = xsId	;					//试卷id
						synthesisObj.sjTitleId = synthesisObj.QuestionID ;				//试题id
						synthesisObj.stOptionId = synthesisObj.OptionID ;				//选项id
						synthesisObj.stText = unescape(synthesisObj.ExamAnswer)	;				//试题答案
						synthesisObj.score = 10;										//分数
						synthesisObj.deleteState = 0 ;									//删除状态						
						arr.push(synthesisObj);
					}
				} 
 				
	    		
	    		
 				console.log(arr);
 				jsonSubmit = JSON.stringify(arr) ;
 				console.log(jsonSubmit);
 				
 				$.ajax({
			        type: "POST",
			        url: "/jysjxssublist/bathSave",
			        data: jsonSubmit,
			        //dataType: "json",
			        contentType: "application/json",
			        success: function (result) {
			        	console.log(result);
			        	if(result.code == 0	){
			        		alert("提交成功");
			        		$("input").attr("disabled",true);
			        		$("textarea").attr("disabled",true);
			        		$(that).val("试卷已提交");
 			        		$(that).css({
		        			  "width":"120px"
		        			}); 
 			        		
			        		//本地存储纪录考试已提交,1表示已提交
							var QuestionID = "examProperty" ;
							var ExamAnswer = "1" ;
							windows.LocalStorage.save(studentID,ExamID,QuestionID,ExamAnswer);
							
							if($(".dd").html()){
								var remainTimeSubmit = $(".dd").html()*24*60 + $(".hh-1").html()*10*60 + $(".hh-2").html()*60 + $(".mm-1").html()*10 + parseInt($(".mm-2").html()) ;
							}else{
								var remainTimeSubmit = $(".hh-1").html()*10*60 + $(".hh-2").html()*60 + $(".mm-1").html()*10 + parseInt($(".mm-2").html()) ;
							}
							var sc = remainTime - remainTimeSubmit ;//考试用时							
							
							var objSubmit =  new Object() ;
							objSubmit.id = xsId ;
							objSubmit.state = "1" ;
							objSubmit.sc = sc ;
							var jsonSubmit2 = JSON.stringify(objSubmit) ;
							console.log(jsonSubmit2);
							


							
							$.ajax({
								type: "POST",
								url: "/jysjxs/update",
								data: jsonSubmit2,
								//dataType: "json",
								contentType: "application/json",
								success: function (result) {
									console.log(result);
									if(result.code == 0	){
										console.log("修改考试状态成功");
									}else{
										console.log("修改考试状态失败");
									}
								}
							}); 
											
							
			        	}else{
			        		alert("提交信息失败，请联系管理员");
			        	}
			        }
			    }); 
 				
 				
 				
	    		
	    	}else{
	    		return false;
	    	}
	    }
		
		

		/* 后台部分↑ */
		</script>
	</head>
 	<body  oncontextmenu="event.returnValue=false" onselectstart="event.returnValue=false"> 
		<div class="main" >
		
			<!-- 进度条 -->
			<div class="box">
				<div class="tbox" style="text-align:center;">
			        <div class="tiao" style='font-size:18px; line-height:48px;'></div>
			        <font style='font-size:18px; line-height:48px;'>试题加载中，请耐心等待</font>
			    </div>
		    </div>
			<!--nr start-->
			<div class="test_main" style="visibility:hidden;">
				<!-- 答题区开始 -->
				<div class="nr_left">
					<div class="test" id="test">
						<form id="paper" action="" method="post">
							<div class="test_title">
								<p class="test_time">
									<i class="icon iconfont"  style="font-size:24px;padding-top: 3px;">&#xe62a;</i><b class="alt-1">0:00</b>
								</p>
								<font><input type="button" name="test_jiaojuan" onclick="submitPaper(this);" value="交卷"></font>
								<a class="btn no-print" onClick="printClick();" style="display:none;">点击开始打印</a>
							</div>
							
								<div class="main_content">
									<div class="main_content_title">
										<font id="testName">基础考试</font>
									</div>
								</div>
							

							
						</form>
					</div>

				</div>
				<!-- 答题区结束 -->
				
				<!-- 答题卡开始 -->
				
				<div class="nr_right">
					<div class="nr_rt_main">
						<div class="rt_nr1 accordion"  id="accordion">
							<div class="rt_nr1_title">
								<h1>
									<i class="icon iconfont" style="font-size:20px;">&#xe693;</i>答题卡
								</h1>
								<p class="test_time">
									<i class="icon iconfont"  style="font-size:23px;padding-top: 2px;">&#xe62a;</i><b class="alt-1">0:00</b>
								</p>
							</div>
						</div>

					</div>
				</div>
				
				<!-- 答题卡结束 -->
				
			</div>
			

		    
			<!--nr end-->
			<div class="foot"></div>
		</div>

		
		
		<!--时间js-->
		<script type="text/javascript" src="${request.contextPath}/statics/js/modules/test/jquery.countdown.js"></script>
		<script>
			/* 进度条相关↓ */
			var i=0;
		    /*add——创建tbx下的div加文字和变宽度的方法*/
		    function add(i){
			    var tbox =$(".tbox");
	            var tiao =$(".tiao");
				tiao.css("width",i+"%").html(i+"%");
			}	
	
		    /*创建方法（i++循环起来）*/
			function xh(){
				if(i>100){
					//$(".test_main").show();
					$(".test_main").css("visibility","visible");
					$(".box").hide();
					return;
				}
				if(i<=100){
					setTimeout("xh()",20)
					add(i);
			   	 	i++;
				}
			}		
			/* 进度条相关↑ */
			
			window.jQuery(function($) {
				"use strict";
				
				$('time').countDown({
					with_separators : false
				});
				$('.alt-1').countDown({
					css_class : 'countdown-alt-1'
				});
				$('.alt-2').countDown({
					css_class : 'countdown-alt-2'
				});
				
				
				

				
				
				
				//启用进度条
				xh();
				
				
			});
			

			
		</script>


	</body>

</html>